﻿using System;
using System.Xml.Serialization;
using Harvest.Api.Types;

namespace Harvest.Api.Model.Internal
{

//<expense>
//  <created-at type="datetime">2010-10-11T10:31:06Z</created-at>
//  <expense-category-id type="integer">185634</expense-category-id>
//  <id type="integer">533651</id>
//  <is-billed type="boolean">false</is-billed>
//  <is-closed type="boolean">false</is-closed>
//  <notes nil="true"></notes>
//  <project-id type="integer">855102</project-id>
//  <spent-at type="date">2010-10-11</spent-at>
//  <total-cost type="decimal">2.3</total-cost>
//  <units type="decimal">1.0</units>
//  <updated-at type="datetime">2010-10-11T10:31:08Z</updated-at>
//  <user-id type="integer">74045</user-id>
//  <has-receipt type="boolean">true</has-receipt>
//  <receipt-url>https://thommy.harvestapp.com/expenses/533651/receipt?1286793068</receipt-url>
//</expense>

    /// <summary>
    /// 
    /// </summary>
    /// <remarks>
    /// Don't change the XmlElement attributes, otherwise (de)serialization will fail.
    /// </remarks>
    [XmlRoot(ElementName = "expense", IsNullable = false)]
    public class ExpenseItem
    {

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "id", IsNullable = true)]
        public NullableInt Id { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "expense-category-id", IsNullable = true)]
        public NullableInt ExpenseCategoryId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "is-billed", DataType = "boolean")]
        public bool IsBilled { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "is-closed", DataType = "boolean")]
        public bool IsClosed { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "notes")]
        public string Notes { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "project-id", IsNullable = true)]
        public NullableInt ProjectId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "spent-at", DataType = "dateTime", IsNullable = true)]
        public DateTime? SpentAt { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "total-costs", IsNullable = true)]
        public NullableDouble TotalCosts { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "units", IsNullable = true)]
        public NullableDouble Units { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "user-id", IsNullable = true)]
        public NullableInt UserId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "has-receipt", DataType = "boolean")]
        public bool HasReceipt { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [XmlElement(ElementName = "receipt-url")]
        public string ReceiptUrl { get; set; }

    }

}
